#!/bin/bash
#========================================================================
# Author: YSLin
# Email: 
# File Name: buildx86dalvikvm.sh
# Description: 
#   To-do :目前編譯在TARGET=x86會失敗
# Edit History: 
#   2010-11-25    File created.
#========================================================================
base=`pwd`
ANDROID_SRC_DIR=/home/zod/mydroid_froyo32bitx86
cd $ANDROID_SRC_DIR
source build/envsetup.sh
#設定為可以在x86執行的binary out, 目前沒辦法不知道為什麼
lunch sim-eng
#基本arm預設
#lunch generic-eng 

#==============================================================================
#
# 為了能讓dalvikvm跑gprof
#
#==============================================================================

# 1.去掉-O2
#mydroid_froyo32bitx86/build/core/combo/select.mk
#48 $(combo_target)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
#49 #ZOD去掉-O2                                                                                                                                                                              
#50 $(combo_target)RELEASE_CFLAGS := -g -fno-strict-aliasing
#51 $(combo_target)GLOBAL_LDFLAGS :=
#52 $(combo_target)GLOBAL_ARFLAGS := crsP

# 2.加入-pg
#mydroid_froyo32bitx86/build/core/combo/TARGET_linux-x86.mk
#20 ifeq ($(TARGET_SIMULATOR),true)
#21 # When building for the simulator, use the HOST settings as TARGET settings
#22 TARGET_CC := $(HOST_CC) -pg -g
#23 TARGET_CXX := $(HOST_CXX) -pg -g
#修改上面檔案讓編出來的檔案可以profile, debug

#要make相關dalvik的模組
make dexopt dalvikvm core ext framework android.policy services
#cp $ANDROID_SRC_DIR/out/debug/host/linux-x86/pr/sim/system/bin/dalvikvm .
cp $ANDROID_SRC_DIR/out/host/linux-x86/pr/sim/system/bin/dalvikvm $base

#為了dalvikvm找得到lib.so, 移到rund.sh
#sudo ldconfig /home/zod/mydroid_froyo32bitx86/out/host/linux-x86/pr/sim/system/lib                  

#麻煩還是用make [-j4],避免有的library還沒編好
#external/elfcopy;mm
#cd buidl/tools/apriori; mm
#cd bionic; mm
#第一次執行要先mm bionic,不然可能會有相依的libdl.so沒編到
#cd dalvik
#mm 
